#!/usr/bin/env node

const http = require('https');
const user = process.argv[2];

const addr = `https://gitee.com/api/v5/users/${user}/repos?access_token=9bb21421e1a274d7c9643fb93fd8ce9a&type=all&sort=full_name&page=1&per_page=20`;

http.get(addr,(res)=> {
  console.log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  console.log(res.headers);
  console.log();

  let data = '';
  res.on('data',(chunk)=>{
    data += chunk;
  })
  res.on('end',()=> {
   data = JSON.parse(data);
   for(const repos of data){
     console.log(repos.human_name);
   }
  })
})
